package com.scsj.supermarket.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.scsj.supermarket.R;
import com.scsj.supermarket.bean.InterFlowBean;

import java.util.List;

/**
 * 类似物流信息展示
 */

public class OrderProcessAdapter extends BaseQuickAdapter<InterFlowBean, BaseViewHolder> {

    private List data;

    public OrderProcessAdapter(List data) {
        super(R.layout.order_process_item_layout, data);
        this.data = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, InterFlowBean item) {

        helper.setText(R.id.name_tv, item.getName());
        helper.setText(R.id.year_tv, item.getTime());
        helper.setText(R.id.year_tv, item.getTime());

        if (helper.getLayoutPosition() == 0) {
//            helper.setVisible(R.id.v_up_line, false);
            helper.setImageResource(R.id.iv_state, R.mipmap.order_finish);
            helper.setVisible(R.id.v_down_line, true);
        } else if (helper.getLayoutPosition() == data.size()-1) {
            helper.setVisible(R.id.v_down_line, false);
        }
    }
}
